/* 
 * Copyright 2013 Sébastien Mouquet.
 * 
 * This file is part of ECovoiturage.
 * 
 * ECovoiturage is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * ECovoiturage is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Foobar. If not, see http://www.gnu.org/licenses/.
 */
package com.smouquet.ecovoiturage.core.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author sebastien.mouquet
 */
@Entity
@Table(name="utilisateur")
public class Utilisateur implements Serializable
{
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name="id", nullable=false)
    private Integer id;
    
    @Column(name="nom", nullable=false, length=80)
    private String nom;
    
    @Column(name="email", nullable=false, length=100)
    private String email;
    
    @Column(name="mdp", nullable=false, length=15)
    private String mdp;
    
    @Column(name="adresse", nullable=false, length=250)
    private String adresse;
    
    @Column(name="administrateur", nullable=false)
    private boolean administrateur;
    
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="fk_entreprise")
    private Entreprise entreprise;
    
    @OneToMany(mappedBy="utilisateur", fetch=FetchType.LAZY)
    private List<TrajetUtilisateur> trajets;
    
    @OneToMany(mappedBy="utilisateur", fetch=FetchType.LAZY)
    private List<TrajetCommentaire> commentaires;
    
    
    public Utilisateur() {}
    

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMdp() {
        return mdp;
    }

    public void setMdp(String mdp) {
        this.mdp = mdp;
    }

    public String getAdresse() {
        return adresse;
    }

    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }

    public boolean isAdministrateur() {
        return administrateur;
    }

    public void setAdministrateur(boolean administrateur) {
        this.administrateur = administrateur;
    }

    public Entreprise getEntreprise() {
        return entreprise;
    }

    public void setEntreprise(Entreprise entreprise) {
        this.entreprise = entreprise;
    }

    public List<TrajetUtilisateur> getTrajets() {
        return trajets;
    }

    public void setTrajets(List<TrajetUtilisateur> trajets) {
        this.trajets = trajets;
    }

    public List<TrajetCommentaire> getCommentaires() {
        return commentaires;
    }

    public void setCommentaires(List<TrajetCommentaire> commentaires) {
        this.commentaires = commentaires;
    }
}
